<script type="text/javascript" src="/admin/public/js/art_dialog/artDialog.source.js?skin=wzcms"></script>
<script src="/admin/public/js/art_dialog/plugins/iframeTools.source.js" ></script>
<style>
#ubb{
border: 1px solid #c5e2f2;
width: 99%;
height: 95%;
overflow: visible;	
}
</style>
<br>
<textarea id="ubb" cols="20" rows="20" >努力加载中...</textarea>
<script>

function strip_page(html){
	html=html.replace(/\<p style\=\"text-align: center;\"\>\<span style\=\"page-break-after: always;\"\>\[pagesplitxx\]/g,"");
	html=html.replace(/\[pagetitle\]([^\[]*)\[\/pagetitle\]/g,"");
	html=html.replace(/\[pagesplitxx\]/g,"");
	return html;
}

function htmltoubb(){
	str = pattern(strip_page(art.dialog.data('aValue')));
	document.getElementById("ubb").value=str;
}

function pattern(str){
str = str.replace(/<br[^>]*>/ig,'\n');
str = str.replace(/<p[^>\/]*\/>/ig,'\n');
str = str.replace(/\son[\w]{3,16}\s?=\s*([\'\"]).+?\1/ig,'');
str = str.replace(/<hr[^>]*>/ig,'[hr]');
str = str.replace(/<(sub|sup|u|strike|b|i|pre)>/ig,'[$1]');
str = str.replace(/<\/(sub|sup|u|strike|b|i|pre)>/ig,'[/$1]');
str = str.replace(/<(\/)?strong>/ig,'[$1b]');
str = str.replace(/<(\/)?em>/ig,'[$1i]');
str = str.replace(/<(\/)?blockquote([^>]*)>/ig,'[$1blockquote]');
str = str.replace(/<img[^>]*smile=\"(\d+)\"[^>]*>/ig,'[s:$1]');
str = str.replace(/<img[^>]*src=[\'\"\s]*([^\s\'\"]+)[^>]*>/ig,'[img]'+'$1'+'[/img]');

str = str.replace(/http:\/\/www.ali213.net\/showbigpic.html\?/ig,'');

/*flash*/
str = str.replace(/<script[^>]*([^\s\'\"]*)[^>]*>(.+?)<\/script>/ig,'');
str = str.replace(/<embed[^>]*flashvars=[\'\"\s]*([^\s\'\"]+)[^>]*src=[\'\"\s]*([^\s\'\"]*)[^>]*><\/embed>/ig,'[flash]'+'$2'+'?'+'$1'+'[/flash]');
str = str.replace(/<a[^>]*href=[\'\"\s]*([^\s\'\"]*)[^>]*>(.+?)<\/a>/ig,'[url=$1]'+'$2'+'[/url]');
str = str.replace(/<[^>]*?>/ig, '');
str = str.replace(/&amp;/ig, '&');
str = str.replace(/&lt;/ig, '<');
str = str.replace(/&gt;/ig, '>');
str = str.replace(/&gt;/ig, '>');
return str;
}
function ubbtohtml(){
	str = up(document.getElementById("Usource").value);
	document.getElementById("Hresult").value=str;
}

htmltoubb();
</script>
